package com.wufan.day07.java;

import java.util.Arrays;
import java.util.Scanner;

public class triangle {
    public static void main(String[] args) {
        double chang[] = new double[3];
        Scanner sc = new Scanner(System.in);
        boolean flag = true;
        int n = 0;
        System.out.println("--------开始--------");
        while (flag) {
            if (n > 0) {
                System.out.println("是否继续：f-停止，t-继续");
                String str = sc.next();
                if ("f".equals(str)) {
                    System.out.println("--------结束--------");
                    break;
                } else if (!"t".equals(str)) {
                    System.out.println("操作不合法，请重新输入：");
                    continue;
                }
            }
            System.out.println("请输入三角形三条边：");
            for (int i = 0; i < chang.length; i++) {
                chang[i] = sc.nextDouble();
            }
            n++;
            Arrays.sort(chang); //从小到大排序
            if (chang[0] + chang[1] > chang[2]) {
                //两边之和大于第三边
                if (chang[0] == chang[1] && chang[1] == chang[2]) {
                    System.out.println("该三角形是等边三角形");
                    continue;
                } else if (chang[2] == chang[1] || chang[2] == chang[0] || chang[1] == chang[0]) {
                    System.out.println("该三角形是等腰三角形");
                    continue;
                } else {
                    System.out.println("该三角形是普通三角形");
                    continue;
                }
            } else {
                System.out.println("不是三角形");
                continue;
            }
        }
    }
}